package com.chenchao.javafile;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;

/**
 * @encoding : UTF-8
 * @Time : 2020/11/15 18:29
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.javaFile.Test9.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 */
public class Test9 {
    public static void main(String[] args) {
        File file = new File("myjava01/src/fo/aa.txt");
        try (PrintStream printStream = new PrintStream(file);) {
            System.setOut(printStream);
            System.out.println("dfavfavf");
            System.out.println("dfavfavf");
            System.out.println("dfavfavf");
            System.out.println("dfavfafsdf");
            printStream.flush();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }


    }
}
